package org.rule.function;

import cn.hutool.core.util.StrUtil;
import com.googlecode.aviator.runtime.function.AbstractFunction;
import com.googlecode.aviator.runtime.function.FunctionUtils;
import com.googlecode.aviator.runtime.type.AviatorBoolean;
import com.googlecode.aviator.runtime.type.AviatorObject;

import java.util.Map;
import java.util.Objects;

public class ObjectNotNullFunction extends AbstractFunction{
    @Override
    public AviatorObject call(Map<String, Object> env, AviatorObject arg1) {
        Object obj = FunctionUtils.getJavaObject(arg1, env);
        return AviatorBoolean.valueOf(Objects.nonNull(obj));
    }
    @Override
    public String getName() {
        return "obj_not_null";
    }
}
